home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Developer Toolbox 6.1
/
SGI Developer Toolbox 6.1 - Disc 4.iso
/
src
/
demos
/
GL
/
libdemo
/
slider.h
< prev
next >
Wrap
Text File
|
1994-08-01
|
3KB
|
71 lines
/*
* Copyright 1991, 1992, 1993, 1994, Silicon Graphics, Inc.
* All Rights Reserved.
*
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
* the contents of this file may not be disclosed to third parties, copied or
* duplicated in any form, in whole or in part, without the prior written
* permission of Silicon Graphics, Inc.
*
* RESTRICTED RIGHTS LEGEND:
* Use, duplication or disclosure by the Government is subject to restrictions
* as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
* and Computer Software clause at DFARS 252.227-7013, and/or in similar or
* successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
* rights reserved under the Copyright Laws of the United States.
*/
/*
* Definitions for slider bar routines
* Written by Thant Tessman, modified a bit by Gavin Bell
* for Silicon Graphics
*/
#define SLIDER_INT 0
#define SLIDER_FLOAT 1
typedef union { int i; float f; } sliderval;
/*
* This routine is used to add a new slider bar to the current window.
* It returns a generic pointer (to a slider structure defined in
* slider.c that you should never have to mess with).
*
* Arguments are:
*
* title : a printf-style string used as the title of the
* slider. It should contain a %d or %f, which will
* be replaced with the current value.
* type : SLIDER_INT or SLIDER_FLOAT
* min, max : Minimum and maximum possible values (should be
* ints or floats cast to type sliderval)
* variable : Address of the value that should be changing
* cornerx, cornery : Location of lower left corner of the slider in
* the window, expressed as a fraction from 0.0 to
* 1.0
* sizex, sizey : Size of slider, expressed as a fraction of window
* size (0.0 to 1.0). corner+size shouldn't be
* greater than 1.0, or part of the slider will be
* outside the window.
* fn : A function to be called every time the slider
* value changes. The function will be called
* before the slider is drawn.
*
* This routine adds events and updates to almost totally take care of
* the slider for you. The following example creates an integer
* valued, RGB slider in its own window. Its initial value will be
* whatever the value of an_int is.
*
* gid = winopen(sliderwin);
* RGBmode(); doublebuffer(); gconfig();
* add_slider("Value: %d",SLIDER_INT, (float)0, (float)255,
* (sliderval *)&an_int, 0.0, 0.0, 1.0, 1.0, NULL);
*/
char *add_slider(char *title, int type, float min, float max,
sliderval *variable, float cornerx, float cornery,
float sizex, float sizey, void (*fn)());
/*
* This routine is provided to update a slider when it's value changes
* due to something outside of its control.
*/
void draw_slider(char *s);